﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Elysium.Controls;
using Elysium.Demo.Configuracion.Empresa;
using Elysium.Demo.Informes;
using SIIE_ERP.Codigo;


namespace Elysium.Demo.Compras
{
    /// <summary>
    /// Lógica de interacción para Menu_Configuracion.xaml
    /// </summary>
    public partial class Menu_Compras : UserControl
    {
        private UsuarioActivo _sesion;

        public Menu_Compras(ref UsuarioActivo usuario)
        {
            InitializeComponent();
            this._sesion = usuario;
        }

        private void Expander_Catalogos_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Transacciones_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Reportes_Expanded_1(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false; 
        }

        private void ButtonGrupoDeProveedores_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Catalogos.GrupoProveedores_Consulta(ref _sesion);
        }

        private void ButtonProveedores_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Catalogos.Proveedores_Consulta(ref _sesion);
        }

        private void Button_Cotizaciones_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.CotizacionCompras_Consulta(ref _sesion);
        }

        private void Button_OrdenesCompra_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.OrdenCompra_Consulta(ref _sesion);
        }

        private void Button_Recepciones_Click_1(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.Recepcion_Consulta(ref _sesion);
        }

        private void Button_Facturas_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.FacturaCompras_Consulta(ref _sesion);
        }

        private void Button_Devoluciones_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.DevolucionCompras_Consulta(ref _sesion);
        }

        private void Button_NotasCredito_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCompras.Content = new Transacciones.NotaCreditoCompras_Consulta(ref _sesion);
        }


        private void ButtonReporte1_Click_1(object sender, RoutedEventArgs e)
        {
            System.Windows.Window window = new System.Windows.Window
            {
                Title = "Análisis de Compras",
                Content = new ScrollViewer()
                {
                    Content = new Elysium.Demo.Informes.Seleccion_Compras_GraficaMaster(ref _sesion, true),
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                },
                Height = 585,
                Width = 1335,
                WindowStyle = System.Windows.WindowStyle.ToolWindow,
                ResizeMode = ResizeMode.CanResize,
                WindowState = WindowState.Normal,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Icon = new BitmapImage(new Uri("pack://application:,,,/Imagenes/SIE.ico")),
            };

            window.Show();

            //Elysium.Demo.Informes.Seleccion_Compras_GraficaMaster MiReporte = new Informes.Seleccion_Compras_GraficaMaster(ref _sesion, true);

            //Viewbox MiVB = new Viewbox();
            //MiVB.Child = MiReporte;

            //ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCompras.MaxWidth = 1200;
            //ScrollViewCompras.MaxHeight = 526;

            //ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte2_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras_Proveedor MiReporte = new Informes.Seleccion_Compras_Proveedor(ref _sesion, "Informes/Reportes/Operativos/Compras/Proveedor_Compras.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte3_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/Compras/Grupos_Proveedores.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte4_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/Cotizaciones_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_CotizacionCompra, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte5_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/OrdenesCompra_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_OrdenCompra, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte6_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/Recepciones_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_Recepcion, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte7_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/Facturas_Proveedores_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_FacturaProveedor, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte8_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/Devoluciones_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_DevolucionProveedor, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte9_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Compras MiReporte = new Informes.Seleccion_Compras(ref _sesion, "Informes/Reportes/Operativos/Compras/Notas_Credito_Compras.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_NotaCreditoProveedor, true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;
        }

        private void ButtonReporte10_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/Compras/AntiguedadSaldoCXC_Compras.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCompras.MaxWidth = 1200;
            ScrollViewCompras.MaxHeight = 526;

            ScrollViewCompras.Content = MiVB;

        }

        private void ButtonAnalisisCompras_Click_1(object sender, RoutedEventArgs e)
        {
            System.Windows.Window window = new System.Windows.Window
            {
                Title = "Análisis de Precios de Compras",
                Content = new ScrollViewer()
                {
                    Content = new Seleccion_Compras_AnalisisPrecios(ref _sesion, true),
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                },
                Height = 585,
                Width = 1335,
                WindowStyle = System.Windows.WindowStyle.ToolWindow,
                ResizeMode = ResizeMode.CanResize,
                WindowState = WindowState.Normal,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Icon = new BitmapImage(new Uri("pack://application:,,,/Imagenes/SIE.ico")),
            };

            window.Show();
            //Elysium.Demo.Informes.Seleccion_Compras_AnalisisPrecios MiReporte = new Informes.Seleccion_Compras_AnalisisPrecios(ref _sesion, true);

            //Viewbox MiVB = new Viewbox();
            //MiVB.Child = MiReporte;

            //ScrollViewCompras.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCompras.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCompras.MaxWidth = 1200;
            //ScrollViewCompras.MaxHeight = 526;

            //ScrollViewCompras.Content = MiVB;
        }
    }
}
